﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Curchy.MetablogCMS.Models;
using Curchy.MetablogCMS.Persistance;

namespace Curchy.MetablogCMS.Controllers
{
    public class MetablogController : Controller
    {
        public ActionResult Rsd()
        {
            return View();
        }

        public ActionResult Media(string uid)
        {
            Guid key = new Guid(uid);
            Medium mo = MetablogPersistance.GetMedium(key);
            return new ImageResult(mo.Content, mo.Type);
        }

        public ActionResult Permalink(string uid)
        {
            Post post = MetablogPersistance.GetPost(new Guid(uid));
            return new RedirectResult(("/" + post.wp_slug).Replace("//","/"));
        }

        public ActionResult Wlw()
        {
            return View();
        }
    }
}
